import 'package:event_bus/event_bus.dart';

import 'base_http_error_event.dart';

class BaseCode {
  ///网络错误
  static const RESULT_ERROR_NETWORK_ERROR = -1;
  ///网络超时
  static const RESULT_ERROR_NETWORK_TIMEOUT = -2;
  ///其他错误
  static const RESULT_ERROR_OTHER = 0;
  ///登录失效
  static const RESULT_INVALID = 401;
  ///请求成功
  static const RESULT_OK = 1;

  static final EventBus eventBus = new EventBus();

  static errorHandleFunction(code, message) {
    eventBus.fire(BaseHttpErrorEvent(code, message));
    return message;
  }
}